/* --------------------------------------------------------
 * Copyright (c) aeky , Inc.  All rights reserved.
 * --------------------------------------------------------
 */
package com.aeky.client.view.welcome;

import com.aeky.client.common.DemoConstants;
import com.aeky.client.common.DemoEvents;
import com.aeky.client.common.Registry;
import com.aeky.client.mvc.AppEvent;
import com.aeky.client.mvc.Controller;
import com.aeky.client.mvc.EventType;
import com.aeky.client.mvc.View;
import com.aeky.client.view.ib5.IB5;
import com.aeky.client.view.main.MainPortal;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.Layout;

/**
 * 
 * @author aeky
 */
public class CenterBodyPanelView extends View {

    private Layout centerBodyPanel;

    public CenterBodyPanelView(Controller controller) {
        super(controller);
        centerBodyPanel = Registry.get(DemoConstants.CENTER_BODY_PANEL);
    }

    /*
     * 
     * @see com.aeky.client.mvc.View#handleEvent(com.aeky.client.mvc.AppEvent)
     */
    @Override
    protected void handleEvent(AppEvent event) {
        EventType e = event.getType();
        if (e == DemoEvents.INIT) {
            centerBodyPanel.addMember(Registry.<MainPortal> get(DemoConstants.CACHE_MAIN_PORTAL));
        } else if (e == DemoEvents.IB2) {
            centerBodyPanel.removeMembers(centerBodyPanel.getMembers());
            centerBodyPanel.addMember(new Label("test IB2"));
        } else if (e == DemoEvents.IB3) {
            centerBodyPanel.removeMembers(centerBodyPanel.getMembers());
            centerBodyPanel.addMember(Registry.<MainPortal> get(DemoConstants.CACHE_MAIN_PORTAL));
        } else if (e == DemoEvents.IB5) {
            centerBodyPanel.removeMembers(centerBodyPanel.getMembers());
            centerBodyPanel.addMember(new IB5("人员管理"));
        }

    }

}
